<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<title></title>
<%@ include file="/WEB-INF/component/commonCSS.jsp"%>
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1><spring:message code="message.lable.DICqiYeZhuCeLeiXingChaKan"/></h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first"/></a></li>
            <li class="active"><a href="#"><spring:message code="message.lable.DicManage"/></a></li>
            <li class="active"><a href="#"><spring:message code="message.lable.comptypeDic"/></a></li>
        </ol>
    </section>
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
            <form action="${ctx}/dicCompType/exportExcel.html" id="exportExcel" method="post">
             <input id="fileName" name="fileName" type="hidden" value="<spring:message code="message.lable.compTypexls"/>" />
                    <div class="input">
           			<div class="textalign"><spring:message code="message.listForm.QiYeZhuCeLeiXingMingCheng"/>：</div>
                    <div class="boxinput">
                        <input type="text" class="textinput" id="crn" name="compRegName" placeholder="<spring:message code="message.listForm.QiYeZhuCeLeiXingMingCheng"/>" />
                    </div>
                    
                    <div class="textalign"><spring:message code="message.listForm.QiYeZhuCeLeiXingBianMa"/>：</div>
                    <div class="boxinput">
                        <input type="text" class="textinput" id="crc" name="compRegCode" placeholder="<spring:message code="message.listForm.QiYeZhuCeLeiXingBianMa"/>" />
                    </div>
                    
                    <div class="textalign1"><spring:message code="message.lable.status"/>：</div>
                    <div class="boxinput">
                       <select id="status" name="status" class="textinput">
                           	<option value="" ><spring:message code="message.select.option"/></option>
                            <option value="1" ><spring:message code="message.button.start"/></option>
                            <option value="0" ><spring:message code="message.button.stop"/></option>
                           </select>
                     </div>
                     <div class="textalign1" >
                    <button type="button" id="selectDicCompType" onclick="likeQuery();" class="btn btn-success btn-sm"> <spring:message code="message.button.seachSpacing"/></button>
                </div>
                 </div>
                 </form>
            </div>
        </div>
        
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
        <div class=" box box-warning bottongroup">
            <ms:btn url="/dicCompType/add.html"><label id="addNew" class="btn btn-default btn-sm"><spring:message code="message.button.addSpacing"/></label></ms:btn>
            <ms:btn url="/dicCompType/enable.html"><label id="allStart" class="btn btn-default btn-sm" onclick="groupUpdate(1);"><spring:message code="message.button.startSpacing"/></label></ms:btn>
            <ms:btn url="/dicCompType/disable.html"><label id="allDelete" class="btn btn-default btn-sm" onclick="groupUpdate(0);"><spring:message code="message.button.stopSpacing"/></label></ms:btn>
            <label onclick="exportExcel();" class="btn btn-default btn-sm"><spring:message code="message.lable.daoChu"/></label>
        </div>
        <div class="modal fade" id="exampleModal" tabindex="-1" >
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header bg-primary">
                        <button type="button" class="close" data-dismiss="modal" ><span >&times;</span></button>
                        <h5 class="modal-title" id="exampleModalLabel"><spring:message code="message.lable.DICqiYeZhuCeLeiXingXinZeng"/></h5>
                    </div>
                    <div class="modal-body">
                        <div class="form-group form-group-xs" style="width:50%;float:left;padding-right:10px;">
                            <label for="recipient-name" class="control-label"><spring:message code="message.listForm.yiJiQiYeZhuCeLeiXingBianMa"/>：</label>
                            <div class="">
                                <input type="text" class="form-control" id="oCompRegCode" placeholder="<spring:message code="message.listForm.yiJiQiYeZhuCeLeiXingBianMa"/>" maxlength="10">
                            </div>
                        </div>
                        <div class="form-group form-group-xs" style="width:50%;float:left;padding-left:10px;">
                            <label for="recipient-name" class=" control-label"><spring:message code="message.listForm.yiJiQiYeZhuCeLeiXingMingCheng"/>：</label>
                            <div class="">
                                <input type="text" class="form-control" id="oCompRegName" placeholder="<spring:message code="message.listForm.yiJiQiYeZhuCeLeiXingMingCheng"/>" maxlength="255">
                            </div>
                        </div>
                        <div class="form-group form-group-xs">
                            <label for="recipient-name" class=" control-label"><spring:message code="message.lable.remark"/>：</label>
                            <div class="">
                                <textarea rows="1" cols="" class="form-control" id="oRemark" placeholder="<spring:message code="message.lable.remark"/>" maxlength="512"></textarea>
                            </div>
                        </div>
                        <div id="addTwoSpec" style="display:none">
                        <button type="button" id="addDouble" class="btn btn-primary btn-sm"><spring:message code="message.lable.DICqiYeZhuCeLeiXingTianJia"/></button>
                        </div>
                        <div id="twoSpec" style="display:none">
                        <div class="form-group form-group-xs" style="width:50%;float:left;padding-right:10px;">
                            <label for="recipient-name" class="control-label"><spring:message code="message.listForm.erJiQiYeZhuCeLeiXingBianMa"/>：</label>
                            <div class="">
                                <input type="text" class="form-control" id="compRegCode" placeholder="<spring:message code="message.listForm.erJiQiYeZhuCeLeiXingBianMa"/>" maxlength="10">
                            </div>
                        </div>
                        <div class="form-group form-group-xs" style="width:50%;float:left;padding-left:10px;">
                            <label for="recipient-name" class=" control-label"><spring:message code="message.listForm.erJiQiYeZhuCeLeiXingMingCheng"/>：</label>
                            <div class="">
                                <input type="text" class="form-control" id="compRegName" placeholder="<spring:message code="message.listForm.erJiQiYeZhuCeLeiXingMingCheng"/>" maxlength="255">
                            </div>
                        </div>
                        <div class="form-group form-group-xs">
                            <label for="recipient-name" class=" control-label"><spring:message code="message.lable.remark"/>：</label>
                            <div class="">
                                <!-- <input type="textarea" class="form-control" id="remark" placeholder="<spring:message code="message.lable.remark"/>"> -->
                                <textarea rows="1" cols="" class="form-control" id="remark" placeholder="<spring:message code="message.lable.remark"/>" maxlength="512"></textarea>
                            </div>
                        </div>
                    </div>
                    </div>
                    <div class="modal-footer">
                     <input hidden="true" id="spid"/>
                       <input hidden="true" id="spfatherid"/>
                        <button type="button" class="btn btn-primary btn-sm" id="submitDicCompType" onclick="save();"><spring:message code="message.button.saveSpacing"/></button>
                        <button type="button" class="btn btn-danger btn-sm" data-dismiss="modal" id="closeDicCompType"><spring:message code="message.button.closeSpacing"/></button>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <%@ include file="/WEB-INF/component/commonJS.jsp"%>
    <script type="text/javascript">
    
        //绑定回车
        $('#crc,#crn,#status').bind('keydown', function(event) {
            if (event.keyCode == "13") {
                $('#selectDicCompType').click();
            }
        }); 
    
        var type = 0;//1新增 ，2修改，3新增二级企业注册
        var editType=0;//1修改一级企业注册类型，2修改二级企业注册
        var flag = false;
        
        //var id = "";
        $(function () {//新增
            $("#crn").focus();//加载页面光标在通用名上
            
             $('#addNew').click(function () {
                flag=false;
                type=1;
                $("#oCompRegCode").attr("readonly",false);
                $("#oCompRegName").attr("readonly",false);
                $("#oRemark").attr("readonly",false);
                $("#addTwoSpec").show();
                $("#twoSpec").hide();
                $("#spid").val("");
                $("#spfatherid").val("0");
                $('.modal-title').html('<spring:message code="message.lable.DICqiYeZhuCeLeiXingXinZeng"/>');
                $('#oCompRegCode').val("");
                $('#oCompRegName').val("");
                $('#oRemark').val("");
                $('#compRegCode').val("");
                $('#compRegName').val("");
                $('#remark').val("");
                 $('#exampleModal').modal({
                     keyboard: true
                 });
             });
            
            $("#gridlist").jqGrid({
                url: "getCompTypeList.html",
                mtype: "POST",
                datatype: "json",
                autowidth: true,
                height: 270,                    
                colNames: ['<spring:message code="message.jqGrid.cz"/>',
                           '<spring:message code="message.listForm.yiJiQiYeZhuCeLeiXingBianMa"/>',
                           '<spring:message code="message.listForm.yiJiQiYeZhuCeLeiXingMingCheng"/>',
                           '<spring:message code="message.listForm.erJiQiYeZhuCeLeiXingBianMa"/>',
                           '<spring:message code="message.listForm.erJiQiYeZhuCeLeiXingMingCheng"/>',
                           'statusName',
                           '<spring:message code="message.lable.status"/>'
                           ],
                colModel: [
                        
                        { name: 'operate', width: "60", align:"left",
                            formatter : function(val, opts, rowdata) {
                                var compRegCode = rowdata.compRegCode||rowdata.fatherCompRegCode;
                                var compRegName = rowdata.compRegName||rowdata.fatherCompRegName;
                                var str =  "<ms:btn url='/dicCompType/edit.html'><a href=\"javascript:edit('"+rowdata.compRegId+"','"+rowdata.compRegCode+"');\" style='background:url(${ctx}/lib/img/icon/icon.png) no-repeat 0px 0px' class='opIcon' title='<spring:message code="message.jqGrid.cz.bianJi"/>'></a></ms:btn>";
                                str += "<ms:btn url='/dicCompTypeLog/log.html'><a href='${ctx}/dicCompTypeLog/log.html?compRegId="+rowdata.compRegId+"&compRegCode="+rowdata.compRegCode+"&titleCode="+compRegCode+"&titleName="+compRegName+"' style='background:url(${ctx}/lib/img/icon/icon.png) no-repeat -120px 0px' class='opIcon' title='<spring:message code="message.jqGrid.cz.weiHuJiLu"/>'></a></ms:btn>";
                                if(!rowdata.compRegCode ){                              
                                    str += "<ms:btn url='/dicCompType/addTwo.html'><a href='javascript:addTwoSpec(\""+rowdata.compRegId+"\",\""+rowdata.fatherCompRegCode+"\",\""+rowdata.fatherCompRegName+"\",\""+rowdata.fatherRemark+"\");'  style='background:url(${ctx}/lib/img/icon/icon.png) no-repeat -140px 0px' class='opIcon' title='<spring:message code="message.listForm.xinZengErJiQiYeZhuCeLeiXing"/>'></a></ms:btn>";
                                }   
                                    return str; 
                        }},
                        { name: 'fatherCompRegCode', width: "120",align: 'center',sortable: false},
                        { name: 'fatherCompRegName', width: "120",align: 'center' ,sortable: false},
                        { name: 'compRegCode', width: "120",align: 'center',sortable: false},
                        { name: 'compRegName', width: "120",align: 'center',sortable: false},
                        { name: 'statusName', width: "60",hidden:true, align: 'center',sortable: false},
                        { name: 'status', width: "60", align: 'center',sortable: false,
                        	 formatter : function(val, opts, rowdata) {
                        		   if(rowdata.status==1){
                                       return "<spring:message code="message.button.start"/>";
                                   }else{
                                       return "<span class='red'><spring:message code="message.button.stop"/></span>";
                                   }
                        	 }
                        }
                ],
                rowNum: 20,
                rowList: [10, 20, 50,100],
                rownumbers: true,
                pager: "#gridpage",
                viewrecords: true,
                multiselect: true, //勾选框
                gridComplete: function(){
                    var page = $("#gridlist").jqGrid('getGridParam','page');
                    var rows = $('#gridlist').getGridParam("rowNum");
                    var maxnum = (rows*page).toString();
                    var len = (maxnum.length)*10;
                    $('.jqgfirstrow').find('td').eq(0).css('width',len+'px');
                    $('#gridlist_rn').css('width',len+'px');
                    
                    //单条数据自动选中
                    var rowIds = $("#gridlist").jqGrid('getDataIDs');
                    if(rowIds.length==1){
                        $("#"+rowIds[0]).click();
                    }
                },
                caption: "<spring:message code="message.list.comptypeDiclist"/>",
                jsonReader: {
                    repeatitems: false,
                    id: "compRegId"
                }
            });
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
        });
        //编辑
         function edit(compRegId,compRegCode){
            type=2;
            $("#oCompRegCode").attr("readonly",false);
            $("#oCompRegName").attr("readonly",false);
            $("#oRemark").attr("readonly",false);
            $("#addTwoSpec").hide();
            $('.modal-title').html('<spring:message code="message.lable.DICqiYeZhuCeLeiXingBianJi"/>');
            $("#spfatherid").val("");
            $("#spid").val(compRegId);
            $('#exampleModal').modal({
                 keyboard: true
             });
                $.post("${ctx}/dicCompType/initEdit.html", {
                    compRegId : compRegId
                },
                        
                function(result) {
                    if (result.success) {
                        var obj = result.rows;
                        if(obj[0]){
                            $("#oCompRegCode").val(obj[0]);
                            $("#oCompRegName").val(obj[1]);
                            $("#compRegCode").val(obj[2]);
                            $("#compRegName").val(obj[3]);
                            $("#oRemark").val(obj[4]);
                            $("#remark").val(obj[5]);
                            $("#twoSpec").show();
                            $("#oCompRegCode").attr("readonly",true);
                            $("#oCompRegName").attr("readonly",true);
                            $("#oRemark").attr("readonly",true);
                            editType=2;
                        }else{
                            $("#oCompRegCode").val(obj[2]);
                            $("#oCompRegName").val(obj[3]);
                            $("#oRemark").val(obj[5]);
                            $("#compRegCode").val("");
                            $("#compRegName").val("");
                            $("#remark").val("");
                            $("#twoSpec").hide();
                            editType=1;
                        }
                        
                    }else{
                        $("#oCompRegCode").val("");
                        $("#oCompRegName").val("");
                        $("#oCompRegCode").val("");
                        $("#compRegName").val("");
                        $("#remark").val("");
                        $("#oRemark").val("");
                        $("#twoSpec").hide();
                        $.alert(result.msg || "<spring:message code="message.HN.alert.fail"/>", "error");
                    }
                    
                }, "json");
         }
        //停用、启用
        function groupUpdate(status) {
            var msg = "<spring:message code="message.button.stop"/>";
            var url = "${ctx}/dicCompType/enable.html";
            if(status == 1){
                msg = "<spring:message code="message.button.start"/>";
                url = "${ctx}/dicCompType/disable.html";
            }
            var rowIds = $("#gridlist").jqGrid("getGridParam", "selarrrow") || [];
            if (rowIds.length <= 0) {
                $.alert("<spring:message code="message.lable.pleaseSelectOperational"/><spring:message code="message.lable.qiYeZhuCeLeiXing"/><spring:message code="message.yanZheng.ganTanHao"/>", "warn");
                return;
            }
            
            var data = "";
            var list = [];
            for(var i = 0;i<rowIds.length;i++){
                var sta =  $("#gridlist").jqGrid('getRowData',rowIds[i]);
                if(sta.statusName != msg){
                    var compType = "";
                    if(sta.compRegName){
                        compType = sta.compRegName;
                    }else{
                        compType = sta.fatherCompRegName;
                    }
                    
                    data += compType+",";
                    list.push({"compRegId":rowIds[i], "status":status});
                }else{
                    
                }  
            }
            if(data){
                data = data.substring(0,data.length-1);
            }else{
                $.alert("<spring:message code="message.lable.pleaseSelect"/>"+msg+"<spring:message code="message.lable.OKData"/>", "warn");
                return;
            }
            
            $.HN.message.confirm("<spring:message code="message.lable.OKYES"/>"+msg+"<spring:message code="message.lable.FlowerDataYESorNo"/><br/>"+data, '', '').on(function (e) {
                if (e) {
            $.post(url, {
                "array" : json.jsonToString(list)
            }, function(result) {
                if (result.success) {
                    var page = $("#gridlist").jqGrid('getGridParam','page');
                    $.alert(msg+"<spring:message code="message.HN.alert.chengGongCaoZuo"/>"+result.conditions.count+"<spring:message code="message.HN.alert.tiaoShuJu"/>", "success");
                       $("#gridlist").jqGrid('setGridParam',{page:page||1}).trigger("reloadGrid");
                } else {
                    $.alert(result.msg || "<spring:message code="message.HN.alert.fail"/>", "error");
                }
            }, "json");
                }
            });
        }

        
        //新增二级
        function addTwoSpec(fatherId,compRegCode,compRegName,remark){
            type=3;
            $("#oCompRegCode").attr("readonly",true);
            $("#oCompRegName").attr("readonly",true);
            $("#oRemark").attr("readonly",true);
            $("#addTwoSpec").hide();
            $("#twoSpec").show();
            $('.modal-title').html('<spring:message code="message.lable.DICqiYeZhuCeLeiXingTianJia"/>');
            $("#oCompRegCode").val(compRegCode);
            $("#oCompRegName").val(compRegName);
            $('#oRemark').val(remark);
            $('#compRegCode').val("");
            $('#compRegName').val("");
            $('#remark').val("");
            $("#spid").val("");
            $("#spfatherid").val(fatherId);
            $('#exampleModal').modal({
                keyboard: true
            });
        }
        //查询
        function likeQuery(page){
            $('#gridlist').jqGrid('setGridParam',{
                datatype:'json',
                postData:{'compRegCode':$("#crc").val(), 'compRegName':$('#crn').val(), 'status':$('#status').val()},
                page:page||1
            }).trigger("reloadGrid");//重新载入
        }
        
        
         function validate1() {
            var oCompRegCode = $.trim($("#oCompRegCode").val());
            if (oCompRegCode == null || oCompRegCode == "") {
                $.alert("<spring:message code="message.yanZheng.qingShuRu"/><spring:message code="message.listForm.yiJiQiYeZhuCeLeiXingBianMa"/><spring:message code="message.yanZheng.ganTanHao"/>", "warn");
                return false;
            }else if(oCompRegCode.length > 10){
                $.alert("<spring:message code="message.yanZheng.bianMa"/><spring:message code="message.yanZheng.changDuChaoGuoXianZhi"/><spring:message code="message.yanZheng.qingChongXinShuRu"/>","warn");
                return false;
            }
            
            var oCompRegName = $.trim($("#oCompRegName").val());
            if (oCompRegName == null || oCompRegName == "") {
                $.alert("<spring:message code="message.yanZheng.qingShuRu"/><spring:message code="message.listForm.yiJiQiYeZhuCeLeiXingMingCheng"/><spring:message code="message.yanZheng.ganTanHao"/>", "warn");
                return false;
            }else if(oCompRegName.length > 255){
                $.alert("<spring:message code="message.yanZheng.mingChen"/><spring:message code="message.yanZheng.changDuChaoGuoXianZhi"/><spring:message code="message.yanZheng.qingChongXinShuRu"/>","warn");
            }

            return true;
        }
        function validate2() {
            var compRegCode = $.trim($("#compRegCode").val());
            if (compRegCode == null || compRegCode == "") {
                $.alert("<spring:message code="message.yanZheng.qingShuRu"/><spring:message code="message.listForm.erJiQiYeZhuCeLeiXingBianMa"/><spring:message code="message.yanZheng.ganTanHao"/>", "warn");
                return false;
            }else if(oCompRegCode.length > 10){
                $.alert("<spring:message code="message.yanZheng.bianMa"/><spring:message code="message.yanZheng.changDuChaoGuoXianZhi"/><spring:message code="message.yanZheng.qingChongXinShuRu"/>","warn");
                return false;
            }
            
            var compRegName = $.trim($("#compRegName").val());
            if (compRegName == null || compRegName == "") {
                $.alert("<spring:message code="message.yanZheng.qingShuRu"/><spring:message code="message.listForm.erJiQiYeZhuCeLeiXingMingCheng"/><spring:message code="message.yanZheng.ganTanHao"/>", "warn");
                return false;
            }else if(oCompRegName.length > 255){
                $.alert("<spring:message code="message.yanZheng.mingChen"/><spring:message code="message.yanZheng.changDuChaoGuoXianZhi"/><spring:message code="message.yanZheng.qingChongXinShuRu"/>","warn");
            }


            return true;
        }
        
        $("#addDouble").click(function(){
             if (!validate1()) {
                    return;
            }
            $.post("${ctx}/dicCompType/checkRepeat.html", {
                compRegCode : $("#oCompRegCode").val(),
                compRegName : $("#oCompRegName").val()
            }, function(result) {
                if (result.success) {
                    flag = true;
                    $("#twoSpec").show();
                    $("#addTwoSpec").hide();
                    $("#oCompRegCode").attr("readonly",true);
                    $("#oCompRegName").attr("readonly",true);
                    $("#oRemark").attr("readonly",true);
                } else {
                    $.alert(result.msg || "<spring:message code="message.HN.alert.fail"/>", "error");
                }
            }, "json");
        });
        //保存
        function save(){
            var oCompRegCode="";
            var oCompRegName="";
            var oRemark = "";
            var compRegCode="";
            var compRegName="";
            var remark = "";
            if(type==1){
                if(flag){
                    if (!validate2()) {
                        return;
                    }
                    oCompRegCode = $("#oCompRegCode").val();
                    oCompRegName = $("#oCompRegName").val();
                    oRemark =$("#oRemark").val();
                     compRegCode = $("#compRegCode").val();
                     compRegName = $("#compRegName").val();
                     remark = $("#remark").val();
                     if(oCompRegCode==compRegCode){
                         $.alert("<spring:message code="message.yanZheng.liangGe"/><spring:message code="message.yanZheng.bianMa"/><spring:message code="message.yanZheng.buNengChongFu"/>", 'warn');
                         return;
                     }
                     if(oCompRegName==compRegName){
                         $.alert("<spring:message code="message.yanZheng.liangGe"/><spring:message code="message.yanZheng.mingChen"/><spring:message code="message.yanZheng.buNengChongFu"/>", 'warn');
                         return;
                     }
                }else{
                    if (!validate1()) {
                        return;
                    }
                    
                     compRegCode = $("#oCompRegCode").val();
                      compRegName = $("#oCompRegName").val();
                      remark = $("#oRemark").val(); 
                }
            }
            if(type==2){
                   if(editType==1){
                       if (!validate1()) {
                            return;
                        }
                       compRegCode = $("#oCompRegCode").val();
                       compRegName = $("#oCompRegName").val();
                        remark = $("#oRemark").val(); 
                   }
                   if(editType==2){
                       if (!validate2()) {
                            return;
                        }
                       compRegCode = $("#compRegCode").val();
                       compRegName = $("#compRegName").val();
                        remark = $("#remark").val(); 
                   }
            }
            if(type==3){
                if (!validate2()) {
                    return;
                }
                
                compRegCode = $("#compRegCode").val();
                 compRegName = $("#compRegName").val();
                 remark = $("#remark").val(); 
            }
             var compRegId = $("#spid").val();
             var fatherId = $("#spfatherid").val();
             
                $.HN.message.confirm('<spring:message code="message.HN.alert.OkSaveYESorNO"/>', '', '').on(function (e) {
                   if (e) {
                	   var url = "${ctx}/dicCompType/add.html";
                       if(compRegId !=null && compRegId != ""){   
                    	   url = "${ctx}/dicCompType/edit.html";    
                       }
                    $.ajax({
                       type: "POST",
                       url: url,
                       data:{
                            compRegCode:compRegCode,
                            compRegName:compRegName,
                            compRegId:compRegId,
                            fatherId:fatherId,
                            oCompRegCode:oCompRegCode,
                            oCompRegName:oCompRegName,
                            oRemark:oRemark,
                            remark:remark
                       },
                       dataType:"json",
                       success: function(result){
                           if(result.success){
                            var page = $("#gridlist").jqGrid('getGridParam','page');
                            $.alert("<spring:message code="message.HN.alert.success"/>", "success");
                               $("#gridlist").jqGrid('setGridParam',{page:page||1}).trigger("reloadGrid");
                            $('#exampleModal').modal('hide');
                           }else{
                            $.alert(result.msg || "<spring:message code="message.HN.alert.fail"/>", "error");
                                   }
                               }
                        });
                    }
             });
        }
        
        function exportExcel(){
    		$.HN.message.confirm('<spring:message code="message.lable.OKExport"/>&nbsp;<spring:message code="message.lable.compTypexls"/>&nbsp;<spring:message code="message.lable.ma"/>', '', '').on(function (e) {
	               if (e) {
	            	  $("#exportExcel").submit();
			
	               }
         	 }); 
         	
    	} 
    </script>
</body>
</html>